{extend name="main/index" /}
{block name="main"}
<div class="main-content">
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="#">Home</a>
            </li>

            <li>
                <a href="{:url('admin/Contract/index')}">返回上一级</a>
            </li>
            <li class="active">用户列表</li>
        </ul><!-- .breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
                <span class="input-icon">
                    <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
                    <i class="icon-search nav-search-icon"></i>
                </span>
            </form>
        </div><!-- #nav-search -->
    </div>
    <div class="col-xs-10">

        <div class="col-xs-3"><h3>添加材料合同</h3></div>
        <div class="col-xs-3 page-content"><span class="label label-lg label-purple arrowed"></span></div>
    </div>


    <div class="page-content">
        <div class="row">
        <div class="col-xs-1">
        </div>
            <div class="col-xs-10">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="table-responsive">

                            <form action="return false" method='post' class="form-horizontal" >
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">  项目名称</label>
                                    <div class="col-sm-4">
                                        <select class="form-control" id="form-field-1"  class="col-xs-10 col-sm-5" name="project_name">
                                            {volist name="list" id="v"}
                                            <option class="col-xs-10 col-sm-5 " name="project_name" value="{$v['project_name']}">{$v['project_name']}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 购货单位</label>
                                    <div class="col-sm-9">
                                        <input type="text" id="form-field-1" placeholder="purchasing_unit" name="purchasing_unit"  class="col-xs-10 col-sm-5">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">供货单位</label>
                                    <div class="col-sm-9">
                                        <input type="text" id="form-field-1" placeholder="supplier"  name="supplier" class="col-xs-10 col-sm-5">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 供货材料内容</label>
                                    <div class="col-sm-9">
                                        <input type="text" id="form-field-1" placeholder="material_content" name="material_content" class="col-xs-10 col-sm-5">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 合同总价</label>
                                    <div class="col-sm-9">
                                        <input type="text" id="form-field-1" placeholder="contract_sum" name="contract_sum" class="col-xs-10 col-sm-5">
                                    </div>

                                </div>


                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 付款方式 </label>
                                    <div class="radio">
                                        <label>
                                            <input  type="radio" name="payment_method" class="ace radio_number" value="1"/>
                                            <span class="lbl" >现金支付</span>
                                        </label>
                                        <label>
                                            <input   type="radio" name="payment_method" class="ace radio_number" value="2"/>
                                            <span class="lbl">银行支付</span>
                                        </label>
                                        <label>
                                            <input  type="radio"  name="payment_method" class="ace radio_number" value="3"/>
                                            <span class="lbl">线上支付</span>
                                        </label>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 签订时间</label>
                                    <div class="col-sm-9">
                                        <input type="text" id="form-field-1" placeholder="time" name="time" class="col-xs-10 col-sm-5">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 签订地点</label>
                                    <div class="col-sm-9">
                                        <input type="text" id="form-field-1" placeholder="address" name="address" class="col-xs-10 col-sm-5">
                                    </div>
                                </div>
                                <div class="space-4"></div>


                              <div class="form-group"></div>

                                <div class="space-4"></div>

                                <div class="clearfix form-actions">
                                    <div class="col-md-offset-3 col-md-9">
                                        <button class="btn btn-info add_Warehouse" type="button">
                                            <i class="icon-ok bigger-110"></i>
                                            确认添加
                                        </button>
                                        <button class="btn" type="reset">
                                            <i class="icon-undo bigger-110"></i>
                                            信息重置
                                        </button>
                                    </div>
                                </div>
                              </form>


                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-3">
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
</div>
{/block}

{block name="myjs"}
<script>
    $('.add_Warehouse').click(function(){

        var data = $('form').serialize();

        ItAjax(data);

    });

    function ItAjax(data){
        $.ajax({
            type:'post',
            url: '/admin/Contract/addMaterial',
            dataType:'json',
            data:data,

            success: function (data) {
                console.log(data);
                if (data.status) {
                    alert('成功');
                    return false;
                } else {
                    alert('失败');
                }
            },

            error: function () {
                alert('AJAX执行失败');
            }
        });
    }

</script>
{/block}
